<?php
    $d = View::get('demot'); 
?>
            <div class="title-box">
                <div class="title">
                    <a href="<?php echo View::getRoot(); ?>/demot/pokaz/<?php echo $d['id'] ?>"><?php echo $d['title'] ?></a>
                </div>
                <div class="note">
                    <div class="dib" style="width:48%;">Dodane: <?php echo $d['date']; ?> przez <a href="#"><?php echo UserModel::getUserName(intval($d['id_user'])); ?></a></div>
                    <div class="dib note-right" style="width:48%; text-align: right">                   
                        <a href="#">skomentuj</a> |
                        <a href="#">ulubione</a> |
                        <a href="#">podziel się</a>
                    </div>
                </div>
            </div>
            <div class="image" style="position: relative" >

                 <?php if ($d['id_type'] == DStatus::TYPE_IMAGE): ?>
                        <?php if (file_exists("./bank/demot/normal/".$d['id'].".jpg")): ?>
                            <a href="<?php echo View::getRoot()?>/demot/pokaz/<?php echo $d['id'] ?>"><img class="demot-image" src="<?php echo View::getRoot()?>/bank/demot/normal/<?php echo $d['id'] ?>.jpg"/></a>
                        <?php else: ?>
                            <a href="<?php echo View::getRoot()?>/demot/pokaz/<?php echo $d['id'] ?>"><img class="demot-image" src="<?php echo View::getRoot()?>/bank/demot/def.jpg"/></a>
                        <?php endif; ?>
                    <?php elseif ($d['id_type'] == DStatus::TYPE_MOVIE): ?>
                            <?php echo System::parse_youtube_url($d['movie'], 'embed', 640, 480); ?>
                          
                    <?php else: ?>
                            <a href="<?php echo View::getRoot()?>/demot/pokaz/<?php echo $d['id'] ?>"><img class="demot-image" src="<?php echo View::getRoot()?>/bank/demot/def.jpg"/></a>
                    <?php endif; ?>

                <div class="rank-component">

                    <div class="text">głosowanie:</div>
                    <a class="change" href="<?php echo View::getRoot()?>/demot/rank/<?php echo $d['id'] ?>/rt/plus">
                        <img src="<?php echo View::getPath()?>images/dobre-btn.jpg" alt="zabij_pl_rank">
                    </a>
                    <a class="change" href="<?php echo View::getRoot()?>/demot/rank/<?php echo $d['id'] ?>/rt/minus" style="margin-left:5px">
                        <img src="<?php echo View::getPath()?>images/slabe-btn.jpg" alt="zabij_pl_rank">
                    </a>
                    <div class="progress-bar">
                        <div class="orange-bar" title="<?php echo intval($d['rank_plus']); ?>"></div>
                        <div class="gray-bar" title="<?php echo intval($d['rank_minus']); ?>"></div>
                    </div>
                    <div class="progress-text">
                        głosów: <?php echo intval($d['rank_plus'])+intval($d['rank_minus']); ?> (<?php echo intval($d['rank_plus']); ?>/<?php echo intval($d['rank_minus']); ?>) 
                    </div>
                    
                </div>      
                <div class="fb-like fb-like-demot" data-href="http://tarni.pl/server/demot/pokaz/<?php echo $d['id'] ?>" data-send="false" data-layout="box_count" data-width="450" data-show-faces="false"></div>            
            </div>

<?php if (UserModel::isLoggedIn()): ?>
    <?php include_once 'addComment.php'; ?>
<?php else: ?>
    Aby dodawać komentarze musisz być zalogowany!
<?php endif; ?>


<br/>
<?php include_once 'listComments.php'; ?>

